package table.button;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JButton;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.table.TableCellRenderer;

import com.mxgraph.util.mxResources;

/**
 * @version 1.0 11/09/98
 */
public class ButtonRenderer extends JButton implements TableCellRenderer {
	private static final long serialVersionUID = 1L;

	public ButtonRenderer() {
		setOpaque(true);
	}

	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) {
		
		if(row>0){
			if (isSelected) {
				System.out.println("Selected");
				setForeground(table.getSelectionForeground());
				setBackground(table.getSelectionBackground());
			} else {
				setForeground(table.getForeground());
				setBackground(UIManager.getColor("Button.background"));
			}
		}
		//setText((value == null) ? "" : value.toString());
		
		if (row==0){
			setText(null);
			setBackground(Color.orange);
			setContentAreaFilled(true);
		}else
			setText(mxResources.get("browse"));

			//setBorderPainted(false);

		return this;
		//return table;
	}
}